package com.qd.common.panda.domain.entity.rule;

import com.cdqidi.config.JsonObjectSerializer;
import com.cdqidi.util.page.BaseQuery;
import com.cdqidi.valid.group.DefaultGroup;
import com.cdqidi.valid.group.DeleteGroup;
import com.cdqidi.valid.group.UpdateGroup;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;

/**
 * 费用设置码表
 *
 * @author sjk
 */
@EqualsAndHashCode(callSuper = true)
@Getter
@Setter
public class BillRuleSetDTO extends BaseQuery {

    /**
     * 主键
     */
    @NotBlank(message = "计费规则ID不能为空", groups = {DeleteGroup.class, UpdateGroup.class})
    @Size(max = 50, message = "计费规则ID长度不能超过{max}位", groups = {DeleteGroup.class, UpdateGroup.class})
    private String billRule;
    /**
     * 名称
     */
    @NotBlank(message = "名称不能为空", groups = DefaultGroup.class)
    @Size(max = 200, message = "名称长度不能超过{max}位", groups = DefaultGroup.class)
    private String billRuleName;
    /**
     * 内容
     */
    @Size(max = 500, message = "内容长度不能超过{max}位", groups = DefaultGroup.class)
    @JsonSerialize(using = JsonObjectSerializer.class)
    private String content;
    /**
     * 说明
     */
    @Size(max = 500, message = "说明长度不能超过{max}位", groups = DefaultGroup.class)
    private String note;
    /**
     * 序号
     */
    private Integer idx;

    @Override
    public void freeData() {
        this.billRule = null;
        this.billRuleName = null;
        this.content = null;
        this.note = null;
        this.idx = null;
        super.freeData();
    }
}
